{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "smart_open library not found; falling back to local-filesystem-only\n",
      "[jieba] default dict file path ..\\data\\vocab.txt\n",
      "[jieba] default dict file path ..\\data\\vocab.txt\n",
      "[jieba] load default dict ..\\data\\vocab.txt ...\n",
      "[jieba] load default dict ..\\data\\vocab.txt ...\n",
      ">> Synonyms load wordseg dict [d:\\ProgramData\\Anaconda3\\lib\\site-packages\\synonyms\\data\\vocab.txt] ... \n",
      ">> Synonyms on loading stopwords [d:\\ProgramData\\Anaconda3\\lib\\site-packages\\synonyms\\data\\stopwords.txt] ...\n",
      "[Synonyms] on loading vectors [d:\\ProgramData\\Anaconda3\\lib\\site-packages\\synonyms\\data\\words.vector.gz] ...\n",
      "[{'《建筑结构可靠度设计统一标准》': '2018', '《建筑工程抗震设防分类标准》': '2008', '《建筑结构荷载规范》': '2012', '《混凝土结构设计规范》': '2015', '《建筑抗震设计规范》': '2016', '《建筑地基基础设计规范》': '2011', '《河南省建筑地基基础勘察设计规范》': '2014', '《砌体结构设计规范》': '2011', '《建筑变形测量规范》': '2016', '《钢结构设计标准》': '2017', '《门式刚架轻型房屋钢结构设计规范》': '2015', '《冷弯薄壁型钢结构技术规范》': '2002', '《钢结构焊接规范》': '2011', '《涂覆涂料前钢材表面处理表面清洁度的目视评定》': '2011', '《钢结构高强度螺栓连接技术规程》': '2011', '《建筑设计防火规范》': '2018', '《钢结构防火涂料应用技术规程》': '90', '《建筑钢结构防火技术规范》': '2017', '《钢结构工程施工质量验收规范》': '2020', '《混凝土结构工程施工质量验收规范》': '2015', '《焊缝无损检测超声检测技术、检测等级和评定》': '2013', '《压型金属板工程应用技术规范》': '2013', '《组合楼板设计与施工规范》': '2016', '《砌体结构工程施工质量验收规范》': '2011', '《建筑地基基础工程施工质量验收规范》': '2018', '《建筑基桩检测技术规范》': '2014', '《混凝土结构耐久性设计标准》': '2019', '《建筑地基处理技术规范》': '2012', '《地下工程防水技术规范》': '2008', '《钢筋机械连接技术规程》': '2016', '《建筑工程施工质量验收统一标准》': '2013', '《人民防空地下室设计规范》': '2005', '《组合结构设计规范》': '2016', '《建筑工程抗浮技术标准》': '2019', '《建筑桩基技术规范》': '2008', '《高层建筑混凝土结构技术规程》': '2010', '《钢结构通用规范》': '2021', '《混凝土结构通用规范》': '2021', '《工程结构通用规范》': '2021', '《砌体结构通用规范》': '2021', '《组合结构通用规范》': '2021', '《建筑与市政工程抗震通用规范》': '2021', '《建筑与市政地基基础通用规范》': '2021'}, {'住宅、宿舍、旅馆、医院病房、托儿所、幼儿园': '2.0', '食堂、餐厅、试验室、阅览室、会议室、一般资料档案室': '3.0', '礼堂、剧场、影院、有固定座位的看台、公共洗衣房': '3.5', '商店、展览厅、车站、港口、机场大厅及其旅客等候室': '4.0', '通风机房、电梯机房': '8.0', '餐厅厨房': '4.0', '普通厨房': '2.0', '浴室、卫生间、盥洗室': '2.5', '宿舍走廊、旅馆走廊、医院病房走廊、托儿所走廊、幼儿园走廊、住宅走廊': '2.0', '办公楼走廊、餐厅走廊、医院门诊部走廊': '3.0', '教学楼走廊、其他走廊': '3.5', '宿舍门厅、旅馆门厅、医院病房门厅、托儿所门厅、幼儿园门厅、住宅门厅': '2.0', '办公楼门厅、餐厅门厅、医院门诊部门厅': '3.0', '教学楼门厅、其他门厅': '3.5', '多层住宅楼梯': '2.0', '楼梯': '3.5', '可能出现人员密集的阳台': '3.5', '其他阳台': '2.5', '不上人屋面': '0.5', '上人屋面': '2.0', '屋顶花园': '3.0', '屋顶运动场': '4.5'}]\n",
      "0.126141\n",
      "0.364182\n",
      "0.254\n",
      "0.874\n",
      "'走廊'近义词：\n",
      "  1. 走廊:1.0\n",
      "  2. 走道:0.708884\n",
      "  3. 长廊:0.6772753\n",
      "  4. 过道:0.6414323\n",
      "  5. 廊道:0.5925122\n",
      "  6. 地下隧道:0.5598871\n",
      "  7. 林荫道:0.55053604\n",
      "  8. 中央公园:0.5272914\n",
      "  9. 西翼:0.51344043\n",
      "  10. 北翼:0.49904665\n",
      "None\n",
      "0.874\n",
      "0.874\n"
     ]
    }
   ],
   "source": [
    "\n",
    "#一段练习把列表或者字典以json格式存入文件，并读取的方法\n",
    "import json\n",
    "import synonyms as sy\n",
    "from aip import AipNlp\n",
    "k3=[\"dfds\",\"dfdsfdsfds\"]\n",
    "\n",
    "with open('dict.txt', 'w', encoding='utf-8') as f:\n",
    "    json.dump(k3, f, ensure_ascii=False)\n",
    "\n",
    "with open('通规活荷载.txt', 'r', encoding='utf-8') as f:\n",
    "    d1= json.load(f)\n",
    "    #ff123=f.readline()\n",
    "    #print(ff123)\n",
    "\n",
    "#ss=list(f1)\n",
    "#print(ss[0])\n",
    "#s1=\"{\"住宅房间\": \"2.0\", \"过道、阳台、卫生间\": \"2.5\", \"不上人屋面\": \"0.5\", \"上人星面\": \"2.0\"}\"\n",
    "#d3=json.loads(ff123)\n",
    "print(d1)\n",
    "#print(type(ff123))\n",
    "\"\"\"\n",
    "\n",
    "\n",
    "\"\"\"\n",
    "#对百度nlp接口及synonyms的测试\n",
    "#ru=client.wordSimEmbedding(\"走廊\",\"医院门诊部走廊\")\n",
    "#print(ru)\n",
    "APP_ID = '25827715'\n",
    "API_KEY = '8rb7DAjL6wYFUMwMyjKRcV2r'\n",
    "SECRET_KEY = 'MCIQsXlt0lgF4bHnonRKIehfdwsTb7V4'\n",
    "\n",
    "client = AipNlp(APP_ID, API_KEY, SECRET_KEY)\n",
    "\n",
    "print(client.wordSimEmbedding(\"宿舍\",\"宾馆\")['score'])\n",
    "print(client.wordSimEmbedding(\"走廊\",\"过道\")['score'])\n",
    "\n",
    "\n",
    "\n",
    "print(sy.compare(\"宿舍\",\"宾馆\"))\n",
    "print(sy.compare(\"走廊\",\"过道\"))\n",
    "print(sy.display(\"走廊\"))\n",
    "print(sy.compare(\"你要通过走廊\",\"你不要通过过道\"))\n",
    "print(sy.compare(\"你要通过走廊\",\"你要通过过道\"))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
